
/*
 * Copyright 2002-2022 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 *版权所有2002-2022原作者。
 *
 *根据Apache许可证2.0版许可（“许可证”）；
 *除非符合许可证的规定，否则您不得使用此文件。
 *您可以在以下网址获取许可证副本：
 *
 *https://www.apache.org/licenses/LICENSE-2.0
 *
 *除非适用法律要求或书面同意，软件
 *根据许可证进行的分发是在“按原样”的基础上进行的，
 *无任何明示或暗示的保证或条件。
 *有关管理权限的特定语言，请参阅许可证和
 *许可证下的限制。
 */

package org.springframework.stereotype;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.springframework.core.annotation.AliasFor;

/**
 * Indicates that an annotated class is a "Repository", originally defined by
 * Domain-Driven Design (Evans, 2003) as "a mechanism for encapsulating storage,
 * retrieval, and search behavior which emulates a collection of objects".
 *
 * <p>Teams implementing traditional Jakarta EE patterns such as "Data Access Object"
 * may also apply this stereotype to DAO classes, though care should be taken to
 * understand the distinction between Data Access Object and DDD-style repositories
 * before doing so. This annotation is a general-purpose stereotype and individual teams
 * may narrow their semantics and use as appropriate.
 *
 * <p>A class thus annotated is eligible for Spring
 * {@link org.springframework.dao.DataAccessException DataAccessException} translation
 * when used in conjunction with a {@link
 * org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor
 * PersistenceExceptionTranslationPostProcessor}. The annotated class is also clarified as
 * to its role in the overall application architecture for the purpose of tooling,
 * aspects, etc.
 *
 * <p>As of Spring 2.5, this annotation also serves as a specialization of
 * {@link Component @Component}, allowing for implementation classes to be autodetected
 * through classpath scanning.
 *
 * @author Rod Johnson
 * @author Juergen Hoeller
 * @since 2.0
 * @see Component
 * @see Service
 * @see org.springframework.dao.DataAccessException
 * @see org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor
 */
/**
 *指示带注释的类是“存储库”，最初由
 *领域驱动设计（Evans，2003）作为“封装存储的机制，
 *检索和模拟对象集合的搜索行为”。
 *
 *<p>实施传统雅加达EE模式（如“数据访问对象”）的团队
 *也可以将这个构造型应用于DAO类，尽管应该注意
 *了解数据访问对象和DDD风格存储库之间的区别
 *在这样做之前。这个注释是一个通用的原型和单个团队
 
 *
 *<p>这样注释的类符合Spring的条件
 *｛@link org.springframework.dao.DataAccessException DataAccessException｝翻译
 *与｛@链接一起使用时
 *org.springframework.dao.annotation.PersistenceException翻译后处理器
 *PersistenceExceptionTranslationPostProcessor｝。注释类也被澄清为
 *为了工具的目的，它在整个应用程序体系结构中的作用，
 *方面等。
 *
 *<p>从Spring 2.5开始，此注释还充当
 *｛@link Component@Component｝，允许自动检测实现类
 *通过类路径扫描。
 *
 *@作者罗德·约翰逊
 *@作者于尔根·霍勒
 *@自2.0起
 *@参见组件
 *@see服务
 *@参见org.springframework.dao.DataAccessException
 *@参见org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor
 */
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Component
public @interface Repository {

	/**
	 * The value may indicate a suggestion for a logical component name,
	 * to be turned into a Spring bean in case of an autodetected component.
	 * @return the suggested component name, if any (or empty String otherwise)
	 */
	/**
	 *该值可以指示对逻辑组件名称的建议，
	 *在自动检测到组件的情况下转换为Springbean。
	 *@返回建议的组件名称，如果有的话（否则为空String）
	 */
	@AliasFor(annotation = Component.class)
	String value() default "";

}
